package com.zcc.blog.controller;

import com.zcc.blog.service.FileService;
import com.zcc.blog.untils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zcc
 */
@Api(tags = "文件")
@RestController
public class FileController {
    @Autowired
    FileService fileService;

    @ApiOperation("文件上传")
    @RequiresAuthentication
    @PostMapping("/upload")
    public Result postFile(@RequestParam MultipartFile file){
        return fileService.upload(file);
    }
}
